<template>
  <wd-navbar :left-arrow="props.config.showLeftArrow" :title="props.config.title" :bordered="false" fixed placeholder
             safeAreaInsetTop>
    <template #capsule>
      <wd-navbar-capsule @back="handleBack" @back-home="handleBackHome"/>
    </template>
  </wd-navbar>
</template>

<script setup lang="ts">
import {HOME_PAGE} from "@/utils/commonUtils";

interface NavConfig {
  title: string
  showLeftArrow: boolean
}

const props = defineProps<{
  config: NavConfig
}>()

const handleBack = () => {
  uni.navigateBack()
}

const handleBackHome = () => {
  uni.reLaunch({
    url: HOME_PAGE,
  })
}
</script>

<style scoped lang="scss">

</style>